package com.qf.service.impl;

import com.qf.dao.AccountDao;
import com.qf.service.AccountService;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;


/**
 * @Description: 公用常量
 * @Data: 2022/8/27 21:22
 * @Pacakge: com.qf.service.impl
 * @ClassName: AccountServiceImpl
 * @Author: fan
 */
public class AccountServiceImpl implements AccountService {
    public AccountServiceImpl(){
        System.out.println("AccountServiceImpl的无参构造");
    }
    @Override
    public void addAccount() {
        //Spring容器初始化
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("bean.xml");
      //从容器中获取指定的实例bean
       AccountDao accountDao = (AccountDao) applicationContext.getBean("accountDao");
        System.out.println("accountDao = " + accountDao);
       accountDao.addAccount();

    }
}
